/**
 * Created by Matthew Liu on 1/16/14.
 */
public class Player implements Comparable{
    private final String name;
    private String team;
    private String number;
    private int age;

    public Player(String name, String team, String number, int age) {
        this.name = name;
        this.team = team;
        this.number = number;
        this.age = age;
    }

    public String getName() {
        return name;
    }

    public String getTeam() {
        return team;
    }

    public String getNumber() {
        return number;
    }

    public int getAge() {
        return age;
    }

    @Override
    public int compareTo(Object comparable) {
        Player player = (Player)comparable;
        return name.compareTo(player.getName());
    }

    //equals() and hashCode() auto-generated by IntelliJ

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (!(o instanceof Player)) return false;

        Player player = (Player) o;

        if (!name.equals(player.name)) return false;
        if (!number.equals(player.number)) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = name.hashCode();
        result = 31 * result + number.hashCode();
        return result;
    }


}
